Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds comprehensive unit tests for the private helper functions
_extract_summary_from_responseand_extract_grounding_sourcesin the Google Search tool, significantly improving test coverage for these components. The new tests ensure robust handling of various edge cases, including empty inputs, missing attributes, filtering logic, and correct output formatting.New tests for summary and source extraction helpers:
TestExtractSummaryFromResponseclass with tests covering empty candidates, missing or empty content, handling of multiple text parts, skipping of invalid or empty parts, and ensuring only the first candidate is used.TestExtractGroundingSourcesclass with async tests for empty candidates, missing or empty grounding metadata, handling of chunks without web sources, order preservation, filtering of invalid URLs (including Vertex AI Search redirects), and mixed valid/filtered sources.Test infrastructure improvements:
AsyncMock,patch, and the tested helper functions. [1] [2]